package ControlLayer;
import ModelLayer.*;

/**
 * Write a description of class DVDCtr here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class DVDCtr
{

    private DVDRecords dvdRecords;

    /**
     * Constructor for objects of class DVDCtr
     */
    public DVDCtr()
    {
        dvdRecords = DVDRecords.getInstance();
    }

    /**
     * An example of a method - replace this comment with your own
     * 
     * @param  y   a sample parameter for a method
     * @return     the sum of x and y 
     */
    public void createDVD(int id, String title, String artist, long publicationDate)
    {

        dvdRecords.createDVD(id, title, artist, publicationDate);
        
    }

    public void updateDVD(int choise, int id, String value)
    {
        dvdRecords.updateDVD(choise, id, value);
    }

    public void deleteDVD(int id)
    {
        dvdRecords.removeDVD(id);
    }

    public DVD getDVD(int id)
    {
        return dvdRecords.getDVD(id);
    }

    public void createCopy(int id, long serialNr, long purchaseDate, int purchasePrice) //id is the id number of DVD
    {
        DVD dvd = getDVD(id);
        if (dvd != null) dvd.createCopy(serialNr, purchaseDate, purchasePrice);
    }

    public void updateCopy(int id, int choise, long serialNr, String value)
    {
        DVD dvd = getDVD(id);
        dvd.updateCopy(choise, serialNr, value);
    }

    public void deleteCopy(int id, long serialNr)//id is the id number of the DVD
    {
        getDVD(id).deleteCopy(serialNr);
    }

    public Copy getCopy(int id, long serialNr)
    {
        return getDVD(id).getCopy(serialNr);
    }
    
    public String getCopyStatus(int id, long serialNr)
    {
        return getDVD(id).getCopy(serialNr).getSts();
    }

    public void printDVDInfo(int id)// print single DVD info
    {
        getDVD(id).printDVDInfo();

    }
    
    public String getDVDInfo(int id)// get single DVD info
    {
        return getDVD(id).getDVDInfo();
    }

    public void printAllDVD()// print all DVD info
    {
        dvdRecords.printAllDVD();
    }

    public void printCopyInfo(int id, long serialNr)//print single Copy info
    {
        getCopy(id, serialNr).printCopyInfo();// id is the id number of the DVD
    }

    public void printCopiesInfo(int id)//print all copies infor in one DVD
    {
        getDVD(id).printAllCopies(); //id is the id number of the DVD
    }

}
